﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DAL;
using Model;


namespace DepartmentTest
{
    [TestClass]
    public class UnitTest1
    {
        Department department = new Department();
        Department_DAL department_DAL = new Department_DAL();

        /// <summary>
        /// 新增院系
        /// </summary>
        [TestMethod]
        public void AddDepartmentTest()
        {
            var d = new Department();
            d.DepartmentName = "汉语系";
            var result = department_DAL.addDepartment(d);
            Assert.AreEqual(0, result);
        }

        /// <summary>
        /// 删除院系
        /// </summary>
        [TestMethod]
        public void DeleteDepartmentTest()
        {
            var result = department_DAL.deleteDepartment(18);
            Assert.AreEqual(1, result);
        }

        /// <summary>
        /// 修改院系
        /// </summary>
        [TestMethod]
        public void updateDepartment()
        {
            var d = new Department();
            d.DepartmentId = 17;
            d.DepartmentName = "数码系";
            var result = department_DAL.updateDepartment(d);
            Assert.AreEqual(1, result);
        }
    }
}
